package com.demo;

import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("test")
public class StompController {

    @Autowired
    private SimpMessagingTemplate messagingTemplate;


    @RequestMapping("/send")
    @ResponseBody
    public void send() {
        messagingTemplate.convertAndSend("/topic/greetings", "Hello World!");
    }
}
